<extend name="Public/layout"/>

<block name="body">
    <div class="row">
        <div class="col-xs-12">
            <div class="box flat box-primary">
                <div class="box-body aaaaaa" id="{$boxId}">


                    <div class="table-wrap">
                        <table id="{$tableId}"
                               class="table table-bordered table-hover table-condensed table-nowrap"
                               data-table-name="{$tableId}">
                            <thead>
                            <tr>
                                <th style="text-align: center;vertical-align: middle;" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">今日录单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);">今日订单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">今日金额</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);">今日预估</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">昨天订单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);;">昨天预估</th>
                            </tr>

                            </thead>
							<style type="text/css">
								.ah td{
									padding: 20px 5px;
								}
								.cp_th{
									background-color: #34ccce;padding: 10px;
								}
							</style>
                            <tbody class="ah">

                                <tr>
                                    <td style="text-align: center">{$alldata['today_input_count']||default="0"}</td>
                                    <td style="text-align: center">{$alldata['today_order_count']||default="0"}</td>
                                    <td style="text-align: center">{$alldata['today_money']||default="0"}</td>
                                    <td style="text-align: center">{$alldata['today_yugu']||default="0"}</td>
                                    <td style="text-align: center">{$alldata['yestoday_order_count']||default="0"}</td>
                                    <td style="text-align: center">{$alldata['yestoday_yugu']||default="0"}</td>
                                </tr>

                            </tbody>
                        </table>

                        <table id="{$tableId}2"
                               class="table table-bordered table-hover table-condensed table-nowrap" style="margin-top: 30px;"
                               data-table-name="{$tableId}2">
                            <thead>
                            <tr>
                                <th style="text-align: center;vertical-align: middle;" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">本月录单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);">本月订单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">本月预估</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);">上月录单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #f43f3b, #ec008c);">上月订单</th>
                                <th style="text-align: center" style="background: linear-gradient(45deg, #0081ff, #1cbbb4);">上月预估</th>
                            </tr>

                            </thead>
                            <tbody class="ah">

                            <tr>
                                <td style="text-align: center">{$alldata['thismon_input']||default="0"}</td>
                                <td style="text-align: center">{$alldata['thismon_order']||default="0"}</td>
                                <td style="text-align: center">{$alldata['thismon_yugu']||default="0"}</td>
                                <td style="text-align: center">{$alldata['lastmon_input']||default="0"}</td>
                                <td style="text-align: center">{$alldata['lastmon_order']||default="0"}</td>
                                <td style="text-align: center">{$alldata['lastmon_yugu']||default="0"}</td>
                            </tr>

                            </tbody>
                        </table>

                        <div class="dataTables_tool clearfix" style="margin-top: 10px;">
                            <form>
                                <div class="input-group date" style="width: 204px; float: left;">
                                    <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                    <input type="hidden" name="start_time" class="text date"
                                           value="{:I('get.start_time')}"/>
                                    <input style="width: auto;" type="text" data-name="start_time"
                                           class="form-control date datepicker" value="{:I('get.start_time')}"
                                           placeholder="请选择开始日期"
                                           data-type="date"/>
                                </div>
                                <div class="input-group date" style="width: 204px; float: left;margin-left: 10px;">
                                    <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                    <input type="hidden" name="end_time" class="text date"
                                           value="{:I('get.end_time')}"/>
                                    <input style="width: auto;" type="text" data-name="end_time"
                                           class="form-control date datepicker" value="{:I('get.end_time')}"
                                           placeholder="请选择结束日期"
                                           data-type="date"/>
                                </div>
                                <button style="line-height: 20px;margin-top:auto;margin-left: 10px;" type="submit"
                                        class="btn btn-flat _dt_btns_ btn-default" data-callback="form"
                                        data-param="">
                                    搜索
                                </button>
                            </form>
                        </div>


                        <table id="{$tableId}4"
                               class="table table-bordered table-hover table-condensed table-nowrap" style="margin-top: 10px;"
                               data-table-name="{$tableId}4">
                            <thead>
                            <tr><th colspan="8" class="cp_th">店铺统计</th></tr>
                            <tr>
                                <th style="text-align: center;vertical-align: middle;">店铺名称</th>
                                <th style="text-align: center">活动ID</th>
                                <th style="text-align: center">开始时间</th>
                                <th style="text-align: center">结束时间</th>
                                <th style="text-align: center">结束/天数</th>
                                <th style="text-align: center">今日订单</th>
                                <th style="text-align: center">成交金额</th>
                                <th style="text-align: center">预估收益</th>
                            </tr>

                            </thead>
                            <tbody>
                            <foreach name="gongsibang" item="row2">
                                <tr>
                                    <td style="text-align: left">{$row2['activity_title']}</td>
                                    <td style="text-align: center">{$row2['taobao_act_id']}</td>
                                    <td style="text-align: center">{$row2['start_time']}</td>
                                    <td style="text-align: center">{$row2['end_time']}</td>
                                    <td style="text-align: center">{$row2['days']}</td>
                                    <td style="text-align: center">{$row2['todayordercount']}</td>
                                    <td style="text-align: center">{$row2['ordermoney']}</td>
                                    <td style="text-align: center">{$row2['yugu_money']||default="0.00"}</td>
                                </tr>
                            </foreach>
                            </tbody>
                        </table>

                        <table id="{$tableId}3"
                               class="table table-bordered table-hover table-condensed table-nowrap" style="margin-top: 10px;"
                               data-table-name="{$tableId}3">
                            <thead>
                            <tr><th colspan="4" class="cp_th">公司排行榜</th></tr>
                            <tr>
                                <th style="text-align: center;vertical-align: middle;">#</th>
                                <th style="text-align: center">用户名</th>
                                <th style="text-align: center">预估服务费</th>
                                <th style="text-align: center">入职时间</th>
                            </tr>

                            </thead>
                            <tbody>
                            <foreach name="paihangbang" item="row">
                            <tr>
                                <td style="text-align: center"><php>$i += 1;echo $i</php></td>
                                <td style="text-align: center">{$row['username']}</td>
                                <td style="text-align: center">{$row['money']}</td>
                                <td style="text-align: center">{$row['jointime']}</td>
                            </tr>
                            </foreach>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script>
        $(function () {
            $('.form-control.date.datepicker').change(function () {
                $(this).prev().val($(this).val());
            });

            $('.datepicker').each(function () {
                var $this = $(this);
                var dateType = $(this).attr('data-type');
                var handle = "datepicker";
                var format = "yyyy-mm-dd";
                var options = {
                    language: 'zh-CN',
                    autoclose: true,
                    templates: {
                        leftArrow: '<i class="fa fa-caret-square-o-left"></i>',
                        rightArrow: '<i class="fa fa-long-arrow-right"></i>'
                    },
                }
                switch (dateType) {
                    case 'timestamp':
                    case 'datetime':
                        format = "yyyy-mm-dd hh:ii";
                        handle = 'datetimepicker';
                        break;
                    case 'date':
                        format = "yyyy-mm-dd";
                        handle = 'datepicker';
                        break;
                }
                options.format = format;
                var fieldName = $this.attr('data-name');
                $this[handle](options)
                    .on('changeDate,change', function (e) {
                        var value = $(e.currentTarget).val();
                        $('input[name=' + fieldName + ']').val(value);
                    });
            });
        });
    </script>
</block>